package com.tempjob.admin.dto;

import com.anwen.mongo.annotation.collection.CollectionField;
import com.tempjob.common.model.BaseSearchPageDTO;
import com.tempjob.common.utils.DateUtilsEx;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.io.Serializable;
import java.util.Date;
import java.util.List;

/**
 * 学院
 *
 * @TableName sys_user
 */
@Data
@ApiModel
public class QueryAssistRecordDTO extends BaseSearchPageDTO implements Serializable {

    @ApiModelProperty("学生id")
    private String studentId;

    @ApiModelProperty("帮扶类型:1考验帮扶2就业帮扶")
    private Integer assistType;

    @ApiModelProperty("帮扶时间")
    private List<String> assistTimeRange;

    @ApiModelProperty("帮扶老师")
    private String assistTeacher;

    @ApiModelProperty("手机号码")
    private String phone;

    @ApiModelProperty("学号")
    private String studentNo;

    @ApiModelProperty("学生姓名")
    private String realName;

    @ApiModelProperty("学院")
    private String collegeId;

    @CollectionField(value = "grade_class")
    @ApiModelProperty("班级")
    private String gradeClass;

    @ApiModelProperty("专业")
    private String majorId;

    @ApiModelProperty(hidden = true)
    private Date startTime;

    @ApiModelProperty(hidden = true)
    private Date endTime;

    public Date getStartTime() {
        if (assistTimeRange != null && !assistTimeRange.isEmpty()) {
            startTime = DateUtilsEx.getDayStart(DateUtilsEx.parseDayByDay(assistTimeRange.get(0)));
        }
        return startTime;
    }

    public Date getEndTime() {
        if (assistTimeRange != null && assistTimeRange.size() == 2) {
            endTime = DateUtilsEx.getDayEnd(DateUtilsEx.parseDayByDay(assistTimeRange.get(1)));
        }
        return endTime;
    }
}
